package fr.pud.client.controller.fleet;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import fr.pud.client.i18n.LanguagesConstants;
import fr.pud.client.images.ImagesDatabase;
import fr.pud.client.view.AddVehicleFrame;
import fr.pud.client.view.MainFrame;

/**
 * The controller to close the add vehicle frame.
 * 4 avr. 2012 - Projet_Ose
 * @author Simon Devineau, Adrien Hierry, Leopold Houdin, Pierre Reliquet
 *         Ecole des Mines de Nantes
 *         CloseVehicleFrame.java
 */
public class CloseVehicleFrame extends AbstractAction {
    /**
     * The serial UID
     */
    private static final long serialVersionUID = -975921815142237081L;

    /**
     * Default constructor
     */
    public CloseVehicleFrame() {
        this.putValue(NAME,
                LanguagesConstants.LANGUAGE.getString(LanguagesConstants.CLOSE));
        this.putValue(SMALL_ICON, ImagesDatabase.VALIDATE);
        this.putValue(SHORT_DESCRIPTION, LanguagesConstants.LANGUAGE
                .getString(LanguagesConstants.CLOSE_DESCRIPTION));
    }

    /**
     * Dispose the frame.
     */
    @Override
    public void actionPerformed(ActionEvent aArg0) {
        AddVehicleFrame.getInstance().dispose();
        MainFrame.getMainFrame().setEnabled(true);
    }
}
